Send event-channel notification from console daemon
authorkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Wed, 5 Oct 2005 15:32:07 +0000 (16:32 +0100)
committerkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Wed, 5 Oct 2005 15:32:07 +0000 (16:32 +0100)
to guest console driver when the output ring is
emptied. This can be used to kick transmission of
more characters without needing to poll.

Signed-off-by: Keir Fraser <keir@xensource.com>
tools/console/daemon/io.c

index e4739d977ceea7ad08170e0662586aa75277c135..a841af1c95ae96ee99510e60da232b333985df39 100644 (file)
@@ -86,8 +86,11 @@ static void buffer_append(struct domain *dom)
        struct ring_head *ring = (struct ring_head *)dom->page;
        size_t size;
        u32 oldcons;
+       int notify = 0;
 
        while ((size = ring->prod - ring->cons) != 0) {
+               notify = 1;
+
                if ((buffer->capacity - buffer->size) < size) {
                        buffer->capacity += (size + 1024);
                        buffer->data = realloc(buffer->data, buffer->capacity);
@@ -115,6 +118,9 @@ static void buffer_append(struct domain *dom)
                        buffer->capacity = buffer->max_capacity;
                }
        }
+
+       if (notify)
+               xc_evtchn_send(xc, dom->local_port);
 }
 
 static bool buffer_empty(struct buffer *buffer)